package com.example.demo0

import com.example.util.p

interface SwimStrategy{
    fun swim()
}

class Breaststroke:SwimStrategy{
    override fun swim() {
        p("Breaststroke")
    }

}

class Backstroke:SwimStrategy{
    override fun swim() {
        p("Backstroke")
    }

}

class Freestyle:SwimStrategy{
    override fun swim() {
        p("Freestyle")
    }

}

class Swimmer(private val strategy: SwimStrategy){
    fun swim(){
        strategy.swim()
    }
}

fun main(args:Array<String>){
    val weekendShaw = Swimmer(Freestyle())
    weekendShaw.swim()

    val weekdaysShaw = Swimmer(Breaststroke())
    weekdaysShaw.swim()



}






